# -*- coding: utf-8 -*-

import cv2 as cv
import numpy as np

# 画一个空白图像
# 400列，即宽度400
#[(0,0,0),(0,0,0)...(0,0,0)]
#[...                      ]
#    500行，即高度500
#[...                      ]
#[(0,0,0),(0,0,0)...(0,0,0)]
blank = np.zeros((500, 400, 3), dtype="uint8")

# blank[100:300, 300:350] = 0,0,255 # red
# cv.imshow("Blank", blank)

# 画一条线
# pt1 = (0,0) # 起点
# pt2 = (100,400) # 终点 (x, y) (width, height) (列，行)
# color = (255,255,255) # white
# cv.line(blank, pt1=pt1, pt2=pt2, color=color, thickness=10)
# cv.imshow("Line", blank)

# 画一个矩形
# pt1 = (100,200) #左上角
# pt2 = (300,300) #右下角
# color = (0,255,0) # green
# cv.rectangle(blank, pt1 = pt1, pt2 = pt2, color=color, thickness=10)
# cv.imshow("Rectangle", blank)

# 画一个圆
# center = (200,200) # 圆心
# radius = 50 # 半径
# color = (255,0,0) # blue
# cv.circle(blank, center=center, radius=radius, color=color, thickness=10)
# cv.imshow("Circle", blank)

# 写文字
pt1 = (0,225)
fontFace = cv.FONT_HERSHEY_TRIPLEX
fontScale = 1.0
color = (0,255,0) #green
cv.putText(blank, "Hello World", org=pt1, fontFace=fontFace, fontScale=fontScale, color=color, thickness=2)
cv.imshow("Text", blank)

cv.waitKey(0)